package cn.nawang.ebeim.api.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.nawang.ebeim.api.domain.StorageFile;
import cn.nawang.ebeim.api.repository.StorageFileRepository;
import cn.nawang.ebeim.api.service.StorageFileService;

/**
 * @ClassName: StorageFileServiceImpl
 * @Description: TODO
 * @author fanyb
 * @date Aug 27, 2015 8:36:33 AM
 * @version v1.0
 */
@Service("storageFileService")
public class StorageFileServiceImpl implements StorageFileService{
  
  @Autowired
  private StorageFileRepository storageFileRepository;

  @Override
  public boolean add(StorageFile storageFile) {
    try{
      storageFileRepository.save(storageFile);
      return true;
    }catch(Exception e){
      e.printStackTrace();
    }
    return false;
  }

  @Override
  public StorageFile findByDatasourceIDAndSignature(String datasourceId, String signature) {    
    return storageFileRepository.findByDatasourceIDAndSignature(datasourceId, signature);
  }

}
